package controll;

import dao.CountryDao;
import entity.Countries;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.List;

public class User extends HttpServlet {
    public class Login extends HttpServlet {
        protected void doPost(HttpServletRequest request,
                              HttpServletResponse response) throws
                ServletException, IOException {
            doGet(request, response);

        }

        protected void doGet(HttpServletRequest request,
                             HttpServletResponse response) throws
                ServletException, IOException {
            String s=request.getRequestURI();
            String s2=request.getRequestURL().toString();
            String s3= request.getContextPath();
            String s4=request.getServletPath();
            System.out.println(" =>"+s+" =>"+s2+"   =>"+s3+"   =>"+s4);
            request.setCharacterEncoding("utf-8");
            String user=request.getParameter("user");
            String password=request.getParameter("pwd");
            response.setContentType("text/html;charset=utf-8");
//            UserDao ud=new UserDao();
//            List<UserDao> cts=ud.findAll();
//            PrintWriter out=response.getWriter();
//            out.write("<html><head><title>登录成功</title></head>");
//            out.write("<body>");
//            out.write("<h1>"+user);
//            out.write("<table border='1' cellpadding=\"5\">");
//            for (UserDao c:ud){
//                out.write("<tr>");
//                out.write("<td>"+c.getCountryId()+"</td>");
//                out.write("<td>"+c.getCountryName()+"</td>");
//                out.write("<td>"+c.getRegion_id()+"</td>");
//                out.write("</tr>");
//            }
//            out.write("</table>");
//            out.write("</body></html>");
//            out.close();
//
//
//
//        }

        }
    }
}
